home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.os.ms-windows.apps.compatibility.win95,comp.lang.c++
- Path: newsfeed.internetmci.com!miwok!linex1!news
- From: mfried@linex.com (Marty Fried)
- Subject: Re: HELP - CString conversion?
- X-Nntp-Posting-Host: sp67.linex.com
- Message-ID: <310ae342.2323507@news.linex.com>
- Sender: news@linex1.linex.com
- Organization: Cirrius Cybernetics Corp
- X-Newsreader: Forte Agent .99d/32.179
- References: <NEWTNews.16531.822443361.Postmaster@Jerusalem.netvision.net.il>
- Date: Sun, 28 Jan 1996 02:48:15 GMT
-
- Once upon a time (OK, it was Tue, 23 Jan 96 16:26:35 PDT),
- iti@Jerusalem.netvision.net.il wrote:
- >When I try to read the text from a Edit Control (IDC_EDIT1) with the
- >following code:
- >
- >--------------------------------------------------------------
- >CString callBuf;
- >int msgLen = GetDlgItemText(IDC_EDIT1, callBuf, sizeof(callBuf));
- >--------------------------------------------------------------
- >
- >I get the following error:
- >
- >--------------------------------------------------------------
- >error C2664: 'GetDlgItemText' : cannot convert parameter 2 from 'class
-
- >::CString ' to 'char __far *'
- >--------------------------------------------------------------
- >
- >
- >I am using Visual C++, how can I read the text directly into the CString?
- >I know that I am doing something REAL STUPID so if you can be of any help-
- >
- >Please send any advice you have for me to my EMail address:
- cc: iti@netvision.net.il
-
- You can use a CString directly only if the function calls for a
- constant char * (LPCSTR). Otherwise, you can call
- CString::GetBuffer(), which will return a pointer that you can modify;
- but you must later call ReleaseBuffer() if you do indeed change it.
- This is clearly explained in the documentation for CString.
-
- _______________________________________________________
- Marty Fried - mfried@linex.com Press Enter to Exit
- San Anselmo, CA -NT message
- (MSVC4 + MFC) && (Win95 || NT);
-